package com.icez.in_app_notication_library

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

/**
 * 通知适配器
 * @sample
 * @author Icez
 */
abstract class InAppNoticationAdapter<B: ViewDataBinding> {


    /**
     * 通知停留时间
     * @sample
     * @author Icez
     */
    abstract fun onStayDuration():Long

    /**
     * 通知UI
     * @sample
     * @author Icez
     */
    abstract fun onLayout(): Int

    fun getBinding(context:Context):B{
        val binding = DataBindingUtil.inflate<B>(LayoutInflater.from(context),onLayout(),null,false)
        onBinding(binding)
        return binding
    }

    /**
     * 绑定的UI
     * @sample
     * @author Icez
     */
    abstract fun onBinding(binding:B)

    /**
     * 通知的点击事件
     * @sample
     * @author Icez
     */
    abstract fun onItemClick()

    /**
     * 通知触摸移动的关闭方向
     * @sample 
     * @author Icez
     */
    abstract fun onTouchDismissDirection():InAppNoticationDismissTouchType
}